package webStudio7i.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import webStudio7i.modelo.Alquiler;
import webStudio7i.modelo.Sala;
import webStudio7i.negocio.AlquilerBll;

/**
 * Servlet implementation class reservaSalaServlet
 */
public class reservaSalaServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public reservaSalaServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String fecIni = request.getParameter("txtFechaInicio");
		String fecFin = request.getParameter("txtFechaFin");
		int idSala = Integer.parseInt((request.getParameter("hddIdSala")));
		try{
			Alquiler alq = new Alquiler(); 
			alq.setFechahora_inicio(fecIni);
			alq.setFechahora_fin(fecFin);
			Sala sa  = new Sala();
			sa.setIdsala(idSala);
			alq.setObjSala(sa);
			// coger de la sesion
			alq.setIdusuario_actualizacion(1);
			AlquilerBll objAlqBll = new AlquilerBll();
			
			objAlqBll.insertarAlquiler(alq);
			
		}catch(Exception ex){
			
			
		}	
	}

}
